<?php
class settingController extends RPHP_Controller
{

    //权限前缀
    protected $_pvprefix = "setting";

    //全局设置
    public function setting()
    {

        $priv = array($this->_pvprefix . "_st");

        $model = $this->model;
        $auth  = $model->checkPriv($priv);
        if ($auth) {

            $this->view->auth = $auth;

            $this->view->data = $model->getSetting();
           //print_r($this->view->data);die;
            $this->display();

        }

    }

    // 保存
    public function save()
    {
        $priv = array($this->_pvprefix . "_st");

        $model = $this->model;
        $auth  = $model->checkPriv($priv);
        if ($auth) {
            
            $this->view->code = 900;
            $this->view->auth = $auth;

            if ($_POST['act'] == "savesetting") {
                $this->view->success = "保存全局设置成功";
                $this->view->link    = array(
                    array('name' => '返回全局设置', 'url' => '/setting/setting'),
                );

                $this->view->code = $model->saveSetting($_POST);
            }

            $this->displaydo();

        }
    }

}
